package com.example.myweixin;


import android.app.Fragment;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.myweixin.adapter.RecyclerViewAdapter;
import com.example.myweixin.bean.Img;
import com.example.myweixin.utils.DividerItemDecoration;

import java.util.ArrayList;
import java.util.List;

public class settingsFragment extends Fragment {


    public settingsFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view= inflater.inflate(R.layout.tab04, container, false);
        InitImg();
        RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
        StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(3,StaggeredGridLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(manager);
        RecyclerViewAdapter adapter = new RecyclerViewAdapter(ImgList);
        recyclerView.setAdapter(adapter);
        recyclerView.addItemDecoration(new DividerItemDecoration(
                getActivity(), DividerItemDecoration.BOTH_SET,5,255));
        return view;
    }

    private List<Img> ImgList = new ArrayList<>();

    private void InitImg(){
        for (int i = 0; i < 2; i++) {
            Img xiaozhan_01 = new Img(R.drawable.xiaozhan_01);
            ImgList.add(xiaozhan_01);
            Img xiaozhan_02 = new Img(R.drawable.xiaozhan_02);
            ImgList.add(xiaozhan_02);
            Img xiaozhan_03 = new Img(R.drawable.xiaozhan_03);
            ImgList.add(xiaozhan_03);
            Img xiaozhan_04 = new Img(R.drawable.xiaozhan_04);
            ImgList.add(xiaozhan_04);
            Img xiaozhan_05 = new Img(R.drawable.xiaozhan_05);
            ImgList.add(xiaozhan_05);
            Img xiaozhan_06 = new Img(R.drawable.xiaozhan_06);
            ImgList.add(xiaozhan_06);
            Img xiaozhan_07 = new Img(R.drawable.xiaozhan_07);
            ImgList.add(xiaozhan_07);
            Img xiaozhan_08 = new Img(R.drawable.xiaozhan_08);
            ImgList.add(xiaozhan_08);
            Img xiaozhan_09 = new Img(R.drawable.xiaozhan_09);
            ImgList.add(xiaozhan_09);
            Img xiaozhan_10 = new Img(R.drawable.xiaozhan_10);
            ImgList.add(xiaozhan_10);
            Img xiaozhan_11 = new Img(R.drawable.xiaozhan_11);
            ImgList.add(xiaozhan_11);
            Img xiaozhan_12 = new Img(R.drawable.xiaozhan_12);
            ImgList.add(xiaozhan_12);
            Img xiaozhan_13 = new Img(R.drawable.xiaozhan_13);
            ImgList.add(xiaozhan_13);


        }


    }


}
